package org.file5.util;

import java.util.UUID;

public class UUIDUtil {

	public static String getRandomUUID() {
		return UUID.randomUUID().toString().replace("-", "");
	}

	public static String getNamedUUID(String... seeds) {
		StringBuffer sb = new StringBuffer();
		if (seeds != null && seeds.length > 0) {
			for (String s : seeds) {
				sb.append(s);
			}
			return UUID.nameUUIDFromBytes(sb.toString().getBytes()).toString().replace("-", "");
		}
		return null;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		System.out.println(UUIDUtil.getRandomUUID());
		System.out.println(UUID.nameUUIDFromBytes("80504be73626409faf4e92e5f6710efc_FILE".getBytes()));
		System.out.println(UUIDUtil.getNamedUUID("80504be73626409faf4e92e5f6710efc","_FILE"));
		
		System.out.println(UUID.nameUUIDFromBytes("80504be73626409faf4e92e5f6710efc_PRICE".getBytes()));
	}

}
